//
//  CHSInterviewAnController.m
//  ZXAnimationUtil_Example
//
//  Created by 朱新明 on 2023/9/13.
//  Copyright © 2023 simon. All rights reserved.
//  

#import "CHSInterviewAnController.h"
#import <ZXCategoriesUtil/CAICategories.h>
#import <Masonry/Masonry.h>

@interface CHSInterviewAnController ()

@property (nonatomic, strong) UIScrollView *scrollView;

@property (nonatomic, strong) UILabel *titleLab;

@property (nonatomic, strong) UILabel *answerLab;

@end

@implementation CHSInterviewAnController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"面试题";
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setUI];
    [self addMas];
    [self setData];
}


- (void)setUI{
    [self.view addSubview:self.scrollView];
    [self.scrollView addSubview:self.titleLab];
    [self.scrollView addSubview:self.answerLab];
}


- (void)addMas{
    
    [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view.mas_top).offset([UIApplication sharedApplication].zx_safeAreaStatusBarHeight+44);
        make.bottom.mas_equalTo(self.view.mas_bottom).offset(0);
        make.centerX.mas_equalTo(self.view);
        make.left.mas_equalTo(self.view.mas_left);
    }];
    
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.scrollView.mas_top);
        make.centerX.mas_equalTo(self.scrollView);
        make.left.mas_equalTo(self.scrollView.mas_left).offset(15);
    }];
    
    [self.answerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLab.mas_bottom).offset(20);
        make.centerX.mas_equalTo(self.scrollView);
        make.left.mas_equalTo(self.scrollView.mas_left).offset(15);
        make.bottom.mas_equalTo(self.scrollView.mas_bottom);
    }];

}

- (void)setData{
    self.titleLab.text = [self.dic objectForKey:@"title"];;
    self.answerLab.text = [self.dic objectForKey:@"answer"];;
}



- (UIScrollView *)scrollView{
    if (!_scrollView) {
        UIScrollView *view = [[UIScrollView alloc] init];
        _scrollView = view;
    }
    return _scrollView;
}

- (UILabel *)titleLab
{
    if (!_titleLab) {
        UILabel *lab = [[UILabel alloc] init];
        lab.font = [UIFont zx_systemFontOfSize:16];
        lab.text = NSLocalizedString(@"", nil);
        lab.textColor = [UIColor blackColor];
        lab.numberOfLines = 0;
        _titleLab = lab;
    }
    return _titleLab;
}

- (UILabel *)answerLab
{
    if (!_answerLab) {
        UILabel *lab = [[UILabel alloc] init];
        lab.font = [UIFont zx_systemFontOfSize:16];
        lab.text = NSLocalizedString(@"", nil);
        lab.textColor = [UIColor blackColor];
        lab.numberOfLines = 0;
        _answerLab = lab;
    }
    return _answerLab;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
